package com.lzb.compressmaster.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;

import androidx.annotation.NonNull;

import com.lzb.compressmaster.R;
import com.lzb.compressmaster.basic.BaseSmartDialog;
import com.lzb.compressmaster.databinding.DialogScanSucBinding;

public class ScanSucDialog extends BaseSmartDialog<DialogScanSucBinding> implements View.OnClickListener {

    private int size;

    public ScanSucDialog(@NonNull Context context) {
        super(context);
    }

    public void setSize(int size) {
        this.size = size;
    }

    @Override
    protected boolean canceledOnTouchOutside() {
        return true;
    }

    @Override
    protected int getGravity() {
        return Gravity.CENTER;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_scan_suc;
    }

    @Override
    protected void initView(View view) {
        mDataBinding.tvConfirm.setOnClickListener(this);
        mDataBinding.tvNum.setText(getContext().getString(R.string.scan_num, size));
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.tvConfirm) {
            dismiss();
        }
    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void clickConfirm();
    }
}
